package com.collection.web;

 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;


@EnableTransactionManagement
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@SpringBootApplication
@EnableAsync
@EnableScheduling
@ComponentScan(basePackages={"com.collection"})
public class Application extends SpringBootServletInitializer implements CommandLineRunner {
	
	private static Logger log = LoggerFactory.getLogger(Application.class);
	//程序入口
	public static void main( String[] args ){
		log.info("-------------------审批系统启动开始-------------------------------");
		SpringApplication.run(Application.class, args);
	}


	// Java EE应用服务器配置，
	// 如果要使用tomcat来加载jsp的话就必须继承SpringBootServletInitializer类并且重写其中configure方法
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(Application.class);
	}

	// springboot运行后此方法首先被调用
	// 实现CommandLineRunner抽象类中的run方法 0
                                                                                                                                                                                                                                                                                                                                   	@Override
	public void run(String... args) throws Exception {
		log.info("-------------------审批系统启动完成-------------------------------");
	}
 	
}

